package com.icloud.wallet.boot.controller.app;

import com.icloud.common.core.api.CommonResult;
import com.icloud.common.web.vo.PageVO;
import com.icloud.wallet.boot.dto.RechargeOrderPageDto;
import com.icloud.wallet.boot.dto.WithdrawOrderPageDto;
import com.icloud.wallet.boot.service.ITOrderQueryService;
import com.icloud.wallet.boot.vo.*;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;

@RestController
@Api(tags = "App订单查询接口")
@RequestMapping("/app/order/query")
@RequiredArgsConstructor
public class OrderQueryController {
    private final ITOrderQueryService itOrderQueryService;

    @ApiOperation(value = "充值订单分页查询")
    @PostMapping("/recharge")
    @ResponseBody
    public CommonResult<PageVO<RechargeOrderVO>> rechargeOrderPage(@RequestBody @Valid RechargeOrderPageDto rechargeOrderPageDto){
        return CommonResult.success(itOrderQueryService.rechargeOrderPage(rechargeOrderPageDto));
    }

    @ApiOperation(value = "提现订单分页查询")
    @PostMapping("/withdraw")
    @ResponseBody
    public CommonResult<PageVO<WithdrawOrderVO>> withdrawOrderPage(@RequestBody @Valid WithdrawOrderPageDto withdrawOrderPageDto){
        return CommonResult.success(itOrderQueryService.withdrawOrderPage(withdrawOrderPageDto));
    }
}
